package me.algo.array;

import com.google.common.base.Splitter;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.IntStream;

/**
 * @author guozheng
 * @date 2024/4/20
 */
public class Data {



    public static final int[] DT;
    static {
        String s = null;
        try {
            Path path = Paths.get(Data.class.getClassLoader().getResource("./num.txt").toURI());
            s  = Files.readString(path);


        } catch (Exception e) {
//            DT = new int[0];
        }

        if (s != null) {
            IntStream list = Splitter.on(",").splitToList(s).stream().map(Integer::valueOf).mapToInt(i -> i.intValue());
            int[] array = list.toArray();
            DT = array;
        } else {
            DT = new int[0];
        }
    }


//    }

    public static void main(String[] args) throws IOException, URISyntaxException {
        Path path = Paths.get(Data.class.getClassLoader().getResource("./num.txt").toURI());
        String s = Files.readString(path);
        System.out.println(s.length());
    }
}
